from django.contrib import admin

# Register your models here.
from .models import KeShi, AirType, Bottle, State, Log, Person, Size


class KeShiAdmin(admin.ModelAdmin):
    # fields = ['id', 'name']
    list_display = ('id', 'name', 'loc')
    readonly_fields = ('id',)
admin.site.register(KeShi, KeShiAdmin)



class AirTypeAdmin(admin.ModelAdmin):
    list_display = ('id', 'name')
    readonly_fields = ('id',)
admin.site.register(AirType, AirTypeAdmin)



class BottleAdmin(admin.ModelAdmin):
    list_display = ('id', 'type', 'state', 'size', 'name', 'bro_date', 'loc')
    readonly_fields = ('id', 'type', 'name')
    search_fields = ['name', 'id', 'uid']
admin.site.register(Bottle, BottleAdmin)




class StateAdmin(admin.ModelAdmin):
    list_display = ('id', 'name')
    readonly_fields = ('id',)
admin.site.register(State, StateAdmin)



class LogAdmin(admin.ModelAdmin):
    list_display = ('id', 'person', 'date', 'bottle', 'loc', 'state')
    readonly_fields = ('id',)
admin.site.register(Log, LogAdmin)




class PersonAdmin(admin.ModelAdmin):
    list_display = ('id', 'name')
    readonly_fields = ('id', )
admin.site.register(Person, PersonAdmin)




class SizeAdmin(admin.ModelAdmin):
    list_display = ('id', 'name')
    readonly_fields = ('id', )
admin.site.register(Size, SizeAdmin)




admin.site.site_header = 'AirBottleHub-Admin'   #后台显示
admin.site.site_title = '站点管理员AirBootleHub'     #网站名称